<?php require('includes/header.php'); ?>
<?php require('includes/nav.php'); ?>
	
	<!-- creating div for the page -->
	<div style="width:100%; text-align:center; margin:10px; font-size:150%;">
		<a href="/runningrecords/index.php/record/addrun">Add a run</a>
	</div>
	
	<!-- creating a table for data to be displayed to user -->
	<table class="list">
		<tr>
			<th>Date</th>
			<th>Time</th>
			<th>Miles / Kilometers</th>
			<th>Route</th>
			<th>Comments</th>
			<th>Delete</th>
		</tr>
			
			<?php 
				foreach($result as $r_key => $r_val)
				{
					for($i = 0; $i < count($r_val); $i++)
					{
						if($r_val->routeID == '0')
							$r_val->routeID = "N/A";
					
						echo "<form action=\"/runningrecords/index.php/record/deleterun\" method=\"post\"><p><input type=\"hidden\" name=\"runID\" value=\"" . $r_val->runID . "\" /></p>";
						echo "<tr>";
							echo "<td>" . $r_val->month . "/" . $r_val->day . "/" . $r_val->year . "</td>";
							echo "<td>" . $r_val->hours . ":" . $r_val->minutes . ":" . $r_val->seconds .  "</td>";
							echo "<td>" . $r_val->miles . " / " . $r_val->kilometers . "</td>";
							echo "<td>" . $r_val->routeID  . "</td>";
							echo "<td>" . $r_val->comments  . "</td>";
							echo "<td><button type=\"submit\" style=\"background-color:#900; color:#fff; padding:5px;\">Delete</button></td>";
						echo "</tr>"; 
						echo "</form>";
					}
				}
			?>
	</table>
	
<?php require('includes/footer.php'); ?>